<?php /* Smarty version 2.6.20, created on 2017-08-05 16:27:59
         compiled from product_launch.htm */ ?>
<?php require_once(SMARTY_CORE_DIR . 'core.load_plugins.php');
smarty_core_load_plugins(array('plugins' => array(array('modifier', 'count', 'product_launch.htm', 133, false),array('modifier', 'in_array', 'product_launch.htm', 168, false),array('modifier', 'date_format', 'product_launch.htm', 230, false),)), $this); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>产品发布</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="admin.css" rel="stylesheet" type="text/css" />
<script src="<?php echo $this->_tpl_vars['config']['weburl']; ?>
/script/jquery-1.4.4.min.js" type="text/javascript" charset="utf-8" ></script>
<script src="<?php echo $this->_tpl_vars['config']['weburl']; ?>
/script/my_lightbox.js" type="text/javascript" charset="utf-8"></script>
<script src="<?php echo $this->_tpl_vars['config']['weburl']; ?>
/script/district.js" type="text/javascript" charset="utf-8"></script>
    <script language="javascript" src="<?php echo $this->_tpl_vars['config']['weburl']; ?>
/script/laydate/laydate.js"></script>
<script language="javascript">
var weburl="<?php echo $this->_tpl_vars['config']['weburl']; ?>
";
</script>
</head>
<body>
<div class="container">
<div class="flow">
    <div class="itemtitle">
        <h3>产品详情</h3>
        <ul>
            <li class="current"><a id="base" href="javascript:;"><span>基本信息</span></a></li>
            <?php if ($this->_tpl_vars['firstvalue']['d']['0']): ?><li><a id="spec" href="javascript:;"><span>规格</span></a></li><?php endif; ?>
            <?php if ($this->_tpl_vars['firstvalue']['s']['0']): ?><li><a id="other" href="javascript:;"><span>其它属性</span></a></li><?php endif; ?>
            <li><a id="detail" href="javascript:;"><span>详细介绍</span></a></li>
          
        </ul>
    </div>
</div>
<div class="h35"></div>
<form method="post" action="" enctype="multipart/form-data">
    <table class="table" id="base">
    <thead>
    <tr>
        <th colspan="2" class="partition">基本信息</th>
    </tr>
    </thead>
    
    <tbody>
    <tr>
        <td width="100">所属分类</td>
        <td>
        <?php echo $this->_tpl_vars['typenames']; ?>

        <?php if (! $_GET['catid']): ?>
        <input name="catid" id="catid" type="hidden" value="<?php echo $this->_tpl_vars['de']['catid']; ?>
" />
        <input name="tcatid" id="tcatid" type="hidden" value="<?php echo $this->_tpl_vars['de']['tcatid']; ?>
" />
        <input name="scatid" id="scatid" type="hidden" value="<?php echo $this->_tpl_vars['de']['scatid']; ?>
" />
        <input name="sscatid" id="sscatid" type="hidden" value="<?php echo $this->_tpl_vars['de']['sscatid']; ?>
" />
        <a href="module.php?m=product&s=product_launch.php&editid=<?php echo $_GET['edit']; ?>
&cat=<?php echo $this->_tpl_vars['de']['catid']; ?>
&tcatid=<?php echo $this->_tpl_vars['de']['tcatid']; ?>
&scatid=<?php echo $this->_tpl_vars['de']['scatid']; ?>
&sscatid=<?php echo $this->_tpl_vars['de']['sscatid']; ?>
">编辑</a>
        <?php else: ?>
        <input name="catid" id="catid" type="hidden" value="<?php echo $_GET['catid']; ?>
" />
        <input name="tcatid" id="tcatid" type="hidden" value="<?php echo $_GET['tcatid']; ?>
" />
        <input name="scatid" id="scatid" type="hidden" value="<?php echo $_GET['scatid']; ?>
" />
        <input name="sscatid" id="sscatid" type="hidden" value="<?php echo $_GET['sscatid']; ?>
" />
        <a href="module.php?m=product&s=product_launch.php&editid=<?php echo $_GET['edit']; ?>
&cat=<?php echo $_GET['catid']; ?>
&tcatid=<?php echo $_GET['tcatid']; ?>
&scatid=<?php echo $_GET['scatid']; ?>
&sscatid=<?php echo $_GET['sscatid']; ?>
">编辑</a>
        <?php endif; ?>
        </td>
    </tr>
    
    <tr>
      <td>产品名称</td>
      <td><input maxlength="100" name="title" type="text" id="title" class="w350" value="<?php echo $this->_tpl_vars['de']['pname']; ?>
" /></td>
    </tr>
    
    <tr>
      <td>副标题</td>
      <td>
          <!--<input name="ftitle" type="text" id="ftitle" class="w350" value="<?php echo $this->_tpl_vars['de']['ftitle']; ?>
" />-->
          <textarea name="ftitle" id="ftitle" class="w350" rows="5" cols=""><?php echo $this->_tpl_vars['de']['ftitle']; ?>
</textarea>
      </td>
    </tr>
    
    
    <tr>
      <td>促销提示</td>
      <td>
          <!--<input name="promotion_tips" type="text" id="promotion_tips" class="w350" value="<?php echo $this->_tpl_vars['de']['promotion_tips']; ?>
" />-->
          <textarea name="promotion_tips" id="promotion_tips" class="w350" rows="5" cols=""><?php echo $this->_tpl_vars['de']['promotion_tips']; ?>
</textarea>
      </td>
    </tr>
    
    <tr>
        <td>产品编号</td>
        <td><input value="<?php if ($this->_tpl_vars['de']['code']): ?><?php echo $this->_tpl_vars['de']['code']; ?>
<?php else: ?>1<?php endif; ?>" name="code" type="text" class="w350" /></td>
    </tr>
    
    <tr>
        <td><?php echo $this->_tpl_vars['lang']['keyword']; ?>
</td>
        <td><input name="keywords" type="text" value="<?php echo $this->_tpl_vars['de']['keywords']; ?>
" class="w350" /></td>
    </tr>

    <tr>
        <td>演出场馆</td>
        <td>
            <select name="spot" class="w350">
                <option value="">请选择</option>
                <?php $_from = $this->_tpl_vars['spots']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['vo']):
?>
                <option value="<?php echo $this->_tpl_vars['vo']['id']; ?>
" <?php if ($this->_tpl_vars['de']['spot'] == $this->_tpl_vars['vo']['id']): ?>selected<?php endif; ?> ><?php echo $this->_tpl_vars['vo']['spot_name']; ?>
</option>
                <?php endforeach; endif; unset($_from); ?>
            </select>
        </td>
    </tr>

    <tr>
        <td>艺人名称</td>
        <td><input type="text" name="artist" id="price" class="w350" value="<?php echo $this->_tpl_vars['de']['artist']; ?>
" /></td>
    </tr>
    
    <tr>
        <td>上传图片</td>
        <td>
            <div class="product_image">
                <ul id="list1">
                    <?php $_from = $this->_tpl_vars['de']['pic']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['key'] => $this->_tpl_vars['list']):
?>
                        <li id="p<?php echo $this->_tpl_vars['key']+1; ?>
" data-itemid='<?php echo $this->_tpl_vars['key']+1; ?>
'>
                            <div class="product_image_list"> 
                                <div data_type="handle_image">
                                    <div class="image">
                                    <input name="pic[]" type="hidden" id="img<?php echo $this->_tpl_vars['key']; ?>
" value="<?php echo $this->_tpl_vars['list']; ?>
" />
                                    <?php if ($this->_tpl_vars['list']): ?>
                                    <img id="img<?php echo $this->_tpl_vars['key']; ?>
_img" src="<?php echo $this->_tpl_vars['list']; ?>
_60X60.jpg" width="60">
                                    <?php else: ?>
                                    <img width="60" id="img<?php echo $this->_tpl_vars['key']; ?>
_img" src="<?php echo $this->_tpl_vars['config']['weburl']; ?>
/image/default/nopicsmall.gif"  />
                                    <?php endif; ?>
                                    </div>
                                    <div data_type="handle" class="bg">
                                    <span title="删除" data_type="delete_image">删除</span>
                                    </div>
                                </div>
                                <div class="upload-btn"><a class="upload-button" href="javascript:uploadfile('Style images','img<?php echo $this->_tpl_vars['key']; ?>
',277,373,'product')">上传</a></div>
                            </div>
                        </li>
                    <?php endforeach; endif; unset($_from); ?>
                    <?php $this->assign('count', count($this->_tpl_vars['de']['pic'])); ?>
                    <?php unset($this->_sections['name']);
$this->_sections['name']['name'] = 'name';
$this->_sections['name']['loop'] = is_array($_loop=$this->_tpl_vars['count']*-1+5) ? count($_loop) : max(0, (int)$_loop); unset($_loop);
$this->_sections['name']['show'] = true;
$this->_sections['name']['max'] = $this->_sections['name']['loop'];
$this->_sections['name']['step'] = 1;
$this->_sections['name']['start'] = $this->_sections['name']['step'] > 0 ? 0 : $this->_sections['name']['loop']-1;
if ($this->_sections['name']['show']) {
    $this->_sections['name']['total'] = $this->_sections['name']['loop'];
    if ($this->_sections['name']['total'] == 0)
        $this->_sections['name']['show'] = false;
} else
    $this->_sections['name']['total'] = 0;
if ($this->_sections['name']['show']):

            for ($this->_sections['name']['index'] = $this->_sections['name']['start'], $this->_sections['name']['iteration'] = 1;
                 $this->_sections['name']['iteration'] <= $this->_sections['name']['total'];
                 $this->_sections['name']['index'] += $this->_sections['name']['step'], $this->_sections['name']['iteration']++):
$this->_sections['name']['rownum'] = $this->_sections['name']['iteration'];
$this->_sections['name']['index_prev'] = $this->_sections['name']['index'] - $this->_sections['name']['step'];
$this->_sections['name']['index_next'] = $this->_sections['name']['index'] + $this->_sections['name']['step'];
$this->_sections['name']['first']      = ($this->_sections['name']['iteration'] == 1);
$this->_sections['name']['last']       = ($this->_sections['name']['iteration'] == $this->_sections['name']['total']);
?>
                        <li id="p<?php echo $this->_tpl_vars['key']+$this->_sections['name']['index']+1; ?>
" data-itemid='<?php echo $this->_tpl_vars['key']+$this->_sections['name']['index']+1; ?>
'>
                            <div data_type="handle_image">
                                <div class="image">
                                    <input name="pic[]" type="hidden" id="pic<?php echo $this->_sections['name']['index']; ?>
" value="" />
                                    <img width="60" id="pic<?php echo $this->_sections['name']['index']; ?>
_img" src="<?php echo $this->_tpl_vars['config']['weburl']; ?>
/image/default/nopicsmall.gif"  />
                                </div>
                                <div data_type="handle" class="bg">
                                <span title="删除" data_type="delete_image" class="delete">删除</span>
                                </div>
                            </div>
                            <div class="upload-btn"><a class="upload-button" href="javascript:uploadfile('Style images','pic<?php echo $this->_sections['name']['index']; ?>
',277,373,'product')">上传</a></div>
                        </li>
                    <?php endfor; endif; ?>
                </ul>
            </div>
        </td>
    </tr>
    
    <!--<tr>-->
        <!--<td>市场价</td>-->
        <!--<td><input type="text" name="market_price" id="market_price" maxlength="10" value="<?php if ($this->_tpl_vars['de']['market_price']): ?><?php echo $this->_tpl_vars['de']['market_price']; ?>
<?php else: ?>0.00<?php endif; ?>" /></td>-->
    <!--</tr>-->
    <!---->
    <!--<tr>-->
        <!--<td>成本价</td>-->
        <!--<td><input type="text" name="cost_price" id="cost_price" maxlength="10" value="<?php if ($this->_tpl_vars['de']['cost_price']): ?><?php echo $this->_tpl_vars['de']['cost_price']; ?>
<?php else: ?>0.00<?php endif; ?>" /></td>-->
    <!--</tr>-->
    
    
    <tr>
        <td>标签</td>
        <td>
        <?php $_from = $this->_tpl_vars['tag']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['num'] => $this->_tpl_vars['list']):
?>
        <input <?php if (@ ((is_array($_tmp=$this->_tpl_vars['list']['id'])) ? $this->_run_mod_handler('in_array', true, $_tmp, $this->_tpl_vars['de']['statu']) : in_array($_tmp, $this->_tpl_vars['de']['statu']))): ?>checked="checked"<?php endif; ?> id="statu<?php echo $this->_tpl_vars['num']; ?>
" name="statu[]" type="checkbox" value="<?php echo $this->_tpl_vars['list']['id']; ?>
" /><label for="statu<?php echo $this->_tpl_vars['num']; ?>
"><?php echo $this->_tpl_vars['list']['name']; ?>
</label>
        <?php endforeach; endif; unset($_from); ?>
        </td>
    </tr>
    
    <!--<tr>-->
        <!--<td>库存</td>-->
        <!--<td><input id="amount" name="amount" type="text" value="<?php if ($this->_tpl_vars['de']['amount']): ?><?php echo $this->_tpl_vars['de']['amount']; ?>
<?php else: ?>1<?php endif; ?>"/></td>-->
    <!--</tr>-->
    
    <tr>
        <td>积分</td>
        <td><input id="point" name="point" type="text" value="<?php if ($this->_tpl_vars['de']['point']): ?><?php echo $this->_tpl_vars['de']['point']; ?>
<?php else: ?>0<?php endif; ?>"/></td>
    </tr>

    <tr>
        <td>折扣(几折)</td>
        <td><input name="discount" type="text" value="<?php if ($this->_tpl_vars['de']['discount']): ?><?php echo $this->_tpl_vars['de']['discount']; ?>
<?php else: ?>0<?php endif; ?>"/></td>
    </tr>



    <tr>
        <td>支持选座</td>
        <td><input name="is_seat" type="checkbox" value="1" <?php if ($this->_tpl_vars['de']['is_seat'] == 1): ?> checked <?php endif; ?> /></td>
    </tr>

    <tr>
        <td>支持电子票</td>
        <td><input name="is_electronic_ticket" type="checkbox" value="1" <?php if ($this->_tpl_vars['de']['is_electronic_ticket'] == 1): ?> checked <?php endif; ?>  /></td>
    </tr>

    <tr>
        <td>支持特种票</td>
        <td><input name="is_special_ticket" type="checkbox" value="1" <?php if ($this->_tpl_vars['de']['is_special_ticket'] == 1): ?> checked <?php endif; ?> /></td>
    </tr>

    <tr>
        <td>支持上门自取</td>
        <td><input name="is_door_self" type="checkbox" value="1" <?php if ($this->_tpl_vars['de']['is_door_self'] == 1): ?> checked <?php endif; ?> /></td>
    </tr>

    <tr>
        <td>支持实名认证</td>
        <td><input name="is_real_name" type="checkbox" value="1" <?php if ($this->_tpl_vars['de']['is_real_name'] == 1): ?> checked <?php endif; ?> /></td>
    </tr>

    <tr>
        <td>支持倒计时</td>
        <td><input name="is_skill" type="checkbox" value="1" <?php if ($this->_tpl_vars['de']['is_skill'] == 1): ?> checked <?php endif; ?> /></td>
    </tr>

    <tr>
    <td>限购设置</td>
    <td><input type="text" name="buy_limit" id="buy_limit" maxlength="10" placeholder="设置每人限购几张"  value="<?php echo $this->_tpl_vars['de']['buy_limit']; ?>
" /></td>
    </tr>



    <tr>
        <td>预定时间</td>
        <td>
            <input name="reserve_time" readonly type="text" value="<?php if (! empty ( $this->_tpl_vars['de']['reserve_time'] )): ?><?php echo ((is_array($_tmp=$this->_tpl_vars['de']['reserve_time'])) ? $this->_run_mod_handler('date_format', true, $_tmp, '%Y-%m-%d %H:%M:%S') : smarty_modifier_date_format($_tmp, '%Y-%m-%d %H:%M:%S')); ?>
<?php endif; ?>" onclick="laydate({istime: true, format: 'YYYY-MM-DD hh:mm:ss'})" /></td>
    </tr>

    <tr>
        <td>出售时间</td>
        <td>
            <input name="sell_time" type="text"  readonly value="<?php if (! empty ( $this->_tpl_vars['de']['sell_time'] )): ?><?php echo ((is_array($_tmp=$this->_tpl_vars['de']['sell_time'])) ? $this->_run_mod_handler('date_format', true, $_tmp, '%Y-%m-%d %H:%M:%S') : smarty_modifier_date_format($_tmp, '%Y-%m-%d %H:%M:%S')); ?>
<?php endif; ?>" onclick="laydate({istime: true, format: 'YYYY-MM-DD hh:mm:ss'})" /></td>
    </tr>

    <tr>
        <td>秒杀时间设置</td>
        <td>
            <input name="seckill_time" readonly type="text" value="<?php if (! empty ( $this->_tpl_vars['de']['seckill_time'] )): ?><?php echo ((is_array($_tmp=$this->_tpl_vars['de']['seckill_time'])) ? $this->_run_mod_handler('date_format', true, $_tmp, '%Y-%m-%d %H:%M:%S') : smarty_modifier_date_format($_tmp, '%Y-%m-%d %H:%M:%S')); ?>
<?php endif; ?>" onclick="laydate({istime: true, format: 'YYYY-MM-DD hh:mm:ss'})" /></td>
    </tr>

    <tr>
        <td colspan="99" class="height"></td>
    </tr>
    </tbody>
    </table>

    <table class="table">
        <thead>
        <tr>
            <th colspan="2" class="partition">票品明细</th>
        </tr>
        </thead>

        <tbody>
        <tr>
            <td>库存配置</td>
            <td>
                <div>
                    <table>
                        <thead>
                        <tr>
                            <td>演出开始时间</td>
                            <td>演出结束时间</td>
                            <td>销售价</td>
                            <td>价格说明</td>
                            <td>市场价</td>
                            <td>库存</td>
                            <td>产品货号</td>
                            <td>限购设置</td>
                            <td>操作</td>
                        </tr>
                        </thead>
                        <tbody id="add_product_row">

                         <?php if (! empty ( $this->_tpl_vars['product_list'] )): ?>
                            <?php $_from = $this->_tpl_vars['product_list']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['vo']):
?>
                            <tr>
                                <input type="hidden" name="e_id[]" value="<?php echo $this->_tpl_vars['vo']['id']; ?>
" />
                                <td><input class="text" type="text" onclick="laydate({istime: true, format: 'YYYY-MM-DD hh:mm:ss'})" name="performance_start_time[]"  value="<?php echo ((is_array($_tmp=$this->_tpl_vars['vo']['performance_start_time'])) ? $this->_run_mod_handler('date_format', true, $_tmp, '%Y-%m-%d %H:%M:%S') : smarty_modifier_date_format($_tmp, '%Y-%m-%d %H:%M:%S')); ?>
"></td>
                                <td><input class="text" type="text" name="performance_end_time[]" onclick="laydate({istime: true, format: 'YYYY-MM-DD hh:mm:ss'})"  value="<?php echo ((is_array($_tmp=$this->_tpl_vars['vo']['performance_end_time'])) ? $this->_run_mod_handler('date_format', true, $_tmp, '%Y-%m-%d %H:%M:%S') : smarty_modifier_date_format($_tmp, '%Y-%m-%d %H:%M:%S')); ?>
"></td>
                                <td><input class="text" type="text" name="price[]"  value="<?php echo $this->_tpl_vars['vo']['price']; ?>
"></td>
                                <td><input class="text" type="text" name="price_desc[]"  value="<?php echo $this->_tpl_vars['vo']['price_desc']; ?>
"></td>
                                <td><input class="text" type="text" name="market_price[]"  value="<?php echo $this->_tpl_vars['vo']['market_price']; ?>
"></td>
                                <td><input class="text" type="text" name="stock[]"  value="<?php echo $this->_tpl_vars['vo']['stock']; ?>
"></td>
                                <td><input class="text" type="text" name="sku[]"  value="<?php echo $this->_tpl_vars['vo']['sku']; ?>
"></td>
                                <td><input class="text" type="text" name="pro_buy_limit[]"  value="<?php echo $this->_tpl_vars['vo']['pro_buy_limit']; ?>
"></td>
                                <td><a href="javascript:void(0);" data-id="<?php echo $this->_tpl_vars['vo']['id']; ?>
" class="delete_product">删除</a> </td>
                            </tr>
                            <?php endforeach; endif; unset($_from); ?>
                         <?php else: ?>
                         <tr>
                             <td><input class="text" type="text" onclick="laydate({istime: true, format: 'YYYY-MM-DD hh:mm:ss'})" name="performance_start_time[]"  value=""></td>
                             <td><input class="text" type="text" name="performance_end_time[]" onclick="laydate({istime: true, format: 'YYYY-MM-DD hh:mm:ss'})"  value=""></td>
                             <td><input class="text" type="text" name="price[]"  value=""></td>
                             <td><input class="text" type="text" name="price_desc[]"  value=""></td>
                             <td><input class="text" type="text" name="market_price[]"  value=""></td>
                             <td><input class="text" type="text" name="stock[]"  value=""></td>
                             <td><input class="text" type="text" name="sku[]"  value=""></td>
                             <td><input class="text" type="text" name="pro_buy_limit[]"  value=""></td>
                         </tr>
                        <?php endif; ?>

                        </tbody>

                        <tfoot>
                            <tr>
                                <td colspan="8"> <a id="add_row" style="background: url(../image/admin/addtr.png) no-repeat 0 1px;color: #FF6600;line-height: 25px;padding-left: 17px; cursor: pointer;">新增票品</a> </td>
                            </tr>
                        </tfoot>

                    </table>
                </div>
            </td>
        </tr>
        </tbody>

    </table>



    
    <?php if ($this->_tpl_vars['firstvalue']['d']['0']): ?>
    <table class="table"  id="spec">
    <thead>
    <tr>
        <th colspan="2" class="partition">规格</th>
    </tr>
    </thead>
    
    <tbody class="firstvalue">
    <?php $_from = $this->_tpl_vars['firstvalue']['d']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['num'] => $this->_tpl_vars['list']):
?>
    <tr>
        <td><?php echo $this->_tpl_vars['list']['name']; ?>
</td>
        <td data_type="property_td_<?php echo $this->_tpl_vars['num']; ?>
" class="property">
            <ul class="property_ul" <?php if ($this->_tpl_vars['list']['field'] == 'color'): ?>id="color"<?php endif; ?>>
                <?php echo $this->_tpl_vars['list']['item']; ?>

            </ul>
            <div class="clear"></div>
            <?php if ($this->_tpl_vars['list']['field'] == 'color'): ?>
                <table cellpadding="0" cellspacing="0" data_type="color_img" style="display:none">
                    <thead>
                    <tr>
                        <td>颜色</td>
                        <td width="400">图片（无图片可不填）</td>
                        <td width="100">已有图片</td>
                    </tr>
                    </thead>
                    <tbody>
                    <?php $_from = $this->_tpl_vars['firstvalue']['d']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['key'] => $this->_tpl_vars['list']):
?>
                    <?php if ($this->_tpl_vars['list']['field'] == 'color'): ?>
                    <?php $_from = $this->_tpl_vars['list']['color']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['num'] => $this->_tpl_vars['slist']):
?>
                        <tr id="color_img_tr_<?php echo $this->_tpl_vars['num']; ?>
" style="display:none">
                            <td><?php echo $this->_tpl_vars['slist']['name']; ?>
</td>
                            <td>
                            <input name="color_img[<?php echo $this->_tpl_vars['key']; ?>
_<?php echo $this->_tpl_vars['num']; ?>
]" type="text" id="color_img<?php echo $this->_tpl_vars['num']; ?>
" class="w250" value="<?php echo $this->_tpl_vars['slist']['img']; ?>
" />
                            <a class="upload-button" href="javascript:uploadfile('Style images','color_img<?php echo $this->_tpl_vars['num']; ?>
',310,310,'product');">上传</a>
                            
                            <img align="absmiddle" id="color_img<?php echo $this->_tpl_vars['num']; ?>
_img" class="imgs" src="../image/default/user_admin/transparent.gif" />
                            </td>
                            <td><?php if (! $this->_tpl_vars['slist']['img']): ?>当前无图片<?php else: ?><img align="absmiddle" class="imgs" src="<?php echo $this->_tpl_vars['slist']['img']; ?>
" /><?php endif; ?></td>
                        </tr>
                    <?php endforeach; endif; unset($_from); ?>
                    <?php endif; ?>
                    <?php endforeach; endif; unset($_from); ?>
                    </tbody>
                </table>
            <?php endif; ?>
        </td>
    </tr>
    <?php endforeach; endif; unset($_from); ?>
    </tbody>
    
    <tbody data_type="property_tbody" style="display:none">
    <tr>
        <td>库存配置</td>
        <td class="property">
            <div>
            <table>
                <thead>
                <tr>
                    <?php $_from = $this->_tpl_vars['firstvalue']['d']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['num'] => $this->_tpl_vars['list']):
?>
                    <td><?php echo $this->_tpl_vars['list']['name']; ?>
</td>
                    <?php endforeach; endif; unset($_from); ?>
                    <td>销售价</td>
                    <td>市场价</td>
                    <td>成本价</td>
                    <td>库存</td>
                    <td>产品货号</td>
                </tr> 
                </thead>
                <tbody data_type="property_table"></tbody>
            </table>
            </div>
        </td>
    </tr>        
    </tbody>
    </table>
    <?php endif; ?>
    
    <?php if ($this->_tpl_vars['firstvalue']['s']['0']): ?>
    <table class="table" id="other">
    <thead>
    <tr>
        <th colspan="2" class="partition">其它属性</th>
    </tr>
    </thead>
    
    <tbody>
    <?php $_from = $this->_tpl_vars['firstvalue']['s']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['num'] => $this->_tpl_vars['list']):
?>
        <?php echo $this->_tpl_vars['list']; ?>

    <?php endforeach; endif; unset($_from); ?>
    <tr>
        <td colspan="99" class="height"></td>
    </tr>
    </tbody>   
    </table>
    <?php endif; ?>
    

    <table class="table" id="detail">
    <thead>
    <tr>
        <th colspan="2" class="partition">详细介绍</th>
    </tr>
    </thead>
    
    <tbody>
    <tr>
        <td colspan="2" class="detail">
        <script charset="utf-8" src="<?php echo $this->_tpl_vars['config']['weburl']; ?>
/lib/kindeditor/kindeditor-min.js"></script>
        <script>
            var editor;
            KindEditor.ready(function(K) {
                editor = K.create('textarea[name="detail"]', {});
        });
        </script>
        <textarea name="detail" id="detail" style="width:100%; height:400px;"><?php echo $this->_tpl_vars['de']['detail']; ?>
</textarea>
        </td>
    </tr>
    </tbody>
    </table>
   
    <table class="table" id="logistics">
    <thead>
    <tr>
        <th colspan="2" class="partition">票品地址</th>
    </tr>
    </thead>
    
    <tbody>
    <tr>
        <td width="100">所在地址</td>
        <td>
            <input type="hidden" name="t" id="t" value="<?php echo $this->_tpl_vars['de']['area']; ?>
" />
            <input type="hidden" name="province" id="id_1" value="<?php echo $this->_tpl_vars['de']['province']; ?>
" />
            <input type="hidden" name="city" id="id_2" value="<?php echo $this->_tpl_vars['de']['city']; ?>
" />
            <input type="hidden" name="area" id="id_3" value="<?php echo $this->_tpl_vars['de']['areaid']; ?>
" />
            <?php if ($this->_tpl_vars['de']['area']): ?>
            <div id="d_1"><?php echo $this->_tpl_vars['de']['area']; ?>
&nbsp;&nbsp;<a href="javascript:sd();">编辑</a></div>
            <?php endif; ?>
            <div id="d_2" <?php if ($this->_tpl_vars['de']['area']): ?>class="hidden"<?php endif; ?>>
                <select id="select_1" onChange="selClass(this);">
                <option value="">--请选择--</option>
                <?php echo $this->_tpl_vars['prov']; ?>

                </select>
                <select id="select_2" onChange="selClass(this);" class="hidden"></select>
                <select id="select_3" onChange="selClass(this);" class="hidden"></select>
            </div>
        </td>
    </tr>
    

    
    <tr>
        <td colspan="99" class="height"></td>
    </tr>
    </tbody>
    </table>
   
      
    <table>
    <tr>
        <td colspan="2" style="border-top:1px dotted #DEEFFB;">
            <input type="submit" value="<?php echo $this->_tpl_vars['lang']['submit']; ?>
" class="submit" onClick="return check_value();"/>
            <input name="submit" type="hidden" value="<?php if ($this->_tpl_vars['de']['id']): ?>edit<?php else: ?>submit<?php endif; ?>" />
            <input name="editID" type="hidden" id="editID" value="<?php echo $this->_tpl_vars['de']['id']; ?>
" />
            <input type="hidden" name="freightcon" value="0" />
            <input type="hidden" name="custom_cat" value="0" />
            <input type="hidden" name="rec_pro" value="0" />
            <input type="hidden" name="ptype" value="0" />
        </td>
    </tr>
    </table>
</form>
</div>
</body>
</html>
<script language="javascript" src="<?php echo $this->_tpl_vars['config']['weburl']; ?>
/script/product.js"></script>
<script language="javascript" src="<?php echo $this->_tpl_vars['config']['weburl']; ?>
/script/jquery.dragsort-0.5.1.min.js"></script>
<script type="text/javascript">


    $("#add_row").click(function(){
       var add_table_row = ' <tr>'+
                       '<td><input class="text" type="text"  name="performance_start_time[]" onclick="laydate({istime: true, format: \'YYYY-MM-DD hh:mm:ss\'})"   value=""></td>'+
                       '<td><input class="text" type="text" name="performance_end_time[]" onclick="laydate({istime: true, format: \'YYYY-MM-DD hh:mm:ss\'})"   value=""></td>'+
                       '<td><input class="text" type="text" name="price[]"  value=""></td>' +
                       ' <td><input class="text" type="text" name="price_desc[]"  value=""></td>'+
                       '<td><input class="text" type="text" name="market_price[]"  value=""></td>' +
                       '<td><input class="text" type="text" name="stock[]"  value=""></td>' +
                       '<td><input class="text" type="text" name="sku[]"  value=""></td>' +
                       '<td><input class="text" type="text" name="pro_buy_limit[]"  value=""></td>' +
                       '<td><a href="javascript:void(0)" onclick="$(this).parent().parent().html(\' \').hide();">删除</a></td>'
                       '</tr>';
        $("#add_product_row").append(add_table_row);
    });

    //删除票品
    $(".delete_product").click(function(){
        var id = $(this).attr("data-id");
        var _that = $(this);
        $.post("../../../ajax.php",{id:id,action:'delete_product'},function(ret){
            ret = eval('('+ret+')');
            if(!ret.status){
                alert(ret.msg);
            } else {
                _that.parent().parent().html('').hide();
            }
        });
    });







    $('.addtr').unbind().each(function(){
	$(this).click(function(){
	type=$(this).attr('data_type');
	if(type=='parts') title="选择添加配件";
	if(type=='give') title="选择赠送产品";
	if(type=='related') title="选择相关产品";
	window.parent.iframe_form(type,title,'<?php echo $this->_tpl_vars['config']['weburl']; ?>
/admin/module.php?m=product&s=product_list.php&id=<?php echo $this->_tpl_vars['de']['id']; ?>
&catid=<?php if ($_GET['catid']): ?><?php echo $_GET['catid']; ?>
<?php else: ?><?php echo $this->_tpl_vars['de']['catid']; ?>
<?php endif; ?>&type='+type, 800, 505);
	return false;
	});
});

$('.itemtitle ul li').unbind().each(function(){
	$(this).click(function(){
		id=$(this).children().attr('id');
		$(this).addClass("current").siblings().removeClass("current");	
		if(id=='base')
			$(".container").find("table").removeClass("hidden");
		else
			$(".container").find("#"+id).removeClass("hidden").siblings(".table").addClass("hidden");	
	});
});

var rowtypedata = [
	[
		[1, '', 'al'], 
		[1, ''], 
		[1, ''], 
		[1, ''], 
		[1, ''],
		[1, ''],
		[1, '<div><a href="javascript:;" class="deleterow" onClick="deleterow(this,{1})">删除</a></div>'],
	
	],
];
var addrowdirect = 0;
var addrowkey = 0;
function addrow(name, type) {
	
	$('#'+name+'_tr').show();
	var obj=$('#'+name+'_button')[0];	
	var table = obj.parentNode.parentNode.parentNode.parentNode;
	var iframe=window.parent.document.getElementById("iframe_"+name).contentWindow;
	var tab=iframe.document.getElementById(name+"_table");
	var checkbox= $(tab).find("input[class='checkitem']:checked");
	var typedata = rowtypedata[type];
	$.each(checkbox,function(i){
		var value1=$("#hidden_"+name).val();
		var value2=this.value
		if(value1.indexOf(','+value2+',') <= 0 )
		{
			$("#hidden_"+name).val(value1+value2+',');	
			var tr=$(this).parent().parent();
			if(!addrowdirect) {
				var row = table.insertRow(obj.parentNode.parentNode.rowIndex);
			} else {
				var row = table.insertRow(obj.parentNode.parentNode.rowIndex + 1);
			}
			for(var i = 0; i <= typedata.length - 1; i++) {
				if(i<=6)
				{
					var cell = row.insertCell(i);
					if(i==6)
					{
						var tmp = typedata[i][1];
					}
					else
					{
						var tmp = tr.find('td')[i+1].innerHTML;
					}
					if(i==0){
						cell.className = typedata[i][2];
					}
					tmp = tmp.replace(/\{(n)\}/g, function($1) {return addrowkey;});
					tmp = tmp.replace(/\{(\d+)\}/g, function($1, $2) { return value2+',\''+name+'\''; });
					cell.innerHTML = tmp;
				}
			}
			addrowkey ++;
			addrowdirect =0;
		}
	});
}

function deleterow(obj,id,name) {
	var table = obj.parentNode.parentNode.parentNode.parentNode.parentNode;
	var tr = obj.parentNode.parentNode.parentNode;
	var value=$("#hidden_"+name).val();

	var pattern = ','+id+',';
	str = value.replace(new RegExp(pattern), ",");
	$("#hidden_"+name).val(str);
	table.deleteRow(tr.rowIndex);
}

$("#list1").dragsort({ dragSelector: "div", dragSelectorExclude:"span",dragBetween: true, dragEnd: saveOrder, placeHolderTemplate: "<li class='placeHolder'><div></div></li>" });

function saveOrder()
{
	var data = $("#list1 li").map(function() { return $(this).data("itemid"); }).get();
};

function check_value()
{
    var reserve_time = $("[name='reserve_time']").val();
    var sell_time  = $("[name='sell_time']").val();
    if(Date.parse(reserve_time) > Date.parse(sell_time)){
        alert('预定时间不能大于出售时间');
        $("[name='reserve_time']").focus();
        return false;
    }
	if(!$('#img0').val())
	{
		if($('#pic0').val()=='')
		{
			alert('请上传图片');
			document.getElementById('pic0').focus();
			return false;
		}
	}
	if(!document.getElementById('title').value)
	{
		alert('<?php echo $this->_tpl_vars['lang']['notice_title']; ?>
');
		document.getElementById('title').focus();
		return false;
	}
	if(document.getElementById('catid').value=='')
	{
		alert('<?php echo $this->_tpl_vars['lang']['product_category']; ?>
');
		return false;
	}

	

	
	if($('#id_1').val()=='')
	{
		alert('请选择产品所在区域');
		return false;
	}
}
function load_pic()
{
	$.getScript("<?php echo $this->_tpl_vars['config']['weburl']; ?>
/script/product.js");	
}

/*-------------规格------------------*/
var property_checked = [<?php $_from = $this->_tpl_vars['firstvalue']['d']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['num'] => $this->_tpl_vars['list']):
?><?php if ($this->_tpl_vars['num']+1 == count($this->_tpl_vars['firstvalue']['d'])): ?>''<?php else: ?>'',<?php endif; ?><?php endforeach; endif; unset($_from); ?>];
var str = '';
var V = new Array();
<?php $_from = $this->_tpl_vars['firstvalue']['d']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['num'] => $this->_tpl_vars['list']):
?>
var property_checked_<?php echo $this->_tpl_vars['num']; ?>
 = new Array();
<?php endforeach; endif; unset($_from); ?>

$(function(){
	$('tbody[data_type="property_table"]').find('input[type="text"]').live('change',function(){
		s = $(this).attr('data_type');
		V[s] = $(this).val();
	});
	$('span[data_type="chk"] > input[type="checkbox"]').click(function(){
		into_set();
	});
	$('span[data_type="chk"] > input[type="checkbox"]').click(function(){
		stock_set();
	});
	
	$('input[data_type="stock"]').live('change',function(){
		count_stock();
	});
	$('input[data_type="sku"]').live('change',function(){
		code();
	});
	$('input[data_type="price"]').live('change',function(){
		count_price('price');
	});
	$('input[data_type="market_price"]').live('change',function(){
		count_price('market_price');
	});
	$('input[data_type="cost_price"]').live('change',function(){
		count_price('cost_price');
	});
	$('#color').find('input[type="checkbox"]').click(function(){
		pic_show($(this));
	});
	
	$('input[type="submit"]').click(function(){
		$('input[data_type="price"]').each(function(){
			if($(this).val() == ''){
				$(this).val($('input[name="price"]').val());
			}
		});
		$('input[data_type="stock"]').each(function(){
			if($(this).val() == ''){
				$(this).val('0');
			}
		});
		if($('dl[data_type="property_tbody"]').css('display') == 'none'){
			$('dl[data_type="property_tbody"]').find('input').attr('disabled','disabled');
		}
	});
	
});

function into_set(){
	
	<?php $_from = $this->_tpl_vars['firstvalue']['d']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['num'] => $this->_tpl_vars['list']):
?>
	property_checked_<?php echo $this->_tpl_vars['num']; ?>
 = new Array();
	$('td[data_type="property_td_<?php echo $this->_tpl_vars['num']; ?>
"]').find('input[type="checkbox"]:checked').each(function(){
		v = $(this).attr('data_type');
		i = $(this).val();
	
		property_checked_<?php echo $this->_tpl_vars['num']; ?>
[property_checked_<?php echo $this->_tpl_vars['num']; ?>
.length] = [v,i];
	});
	property_checked[<?php echo $this->_tpl_vars['num']; ?>
] = property_checked_<?php echo $this->_tpl_vars['num']; ?>
;
	<?php endforeach; endif; unset($_from); ?>
}

function stock_set(){
	
	$('input[name="price"]').attr('readonly','readonly').css('background','#E7E7E7 none');
	$('input[name="market_price"]').attr('readonly','readonly').css('background','#E7E7E7 none');
	$('input[name="cost_price"]').attr('readonly','readonly').css('background','#E7E7E7 none');
	$('input[name="amount"]').attr('readonly','readonly').css('background','#E7E7E7 none');
	$('input[name="code"]').attr('readonly','readonly').css('background','#E7E7E7 none');
	
	$('tbody[data_type="property_tbody"]').show();
	str = '<tr>';
		
	<?php echo $this->_tpl_vars['abc']; ?>

	
	if(str == '<tr>'){
		$('input[name="price"]').attr('readonly','').css('background','');
		$('input[name="market_price"]').attr('readonly','').css('background','');
		$('input[name="cost_price"]').attr('readonly','').css('background','');
		$('input[name="amount"]').attr('readonly','').css('background','');
		$('input[name="code"]').attr('readonly','').css('background','');
		$('tbody[data_type="property_tbody"]').hide();
	}
	
	var i=0;
	$('tbody[data_type="property_table"]')
		.empty()
		.html(str)
		.find('input[type="text"]').each(function(){
			s = $(this).attr('data_type');
			try{$(this).val(V[s])}catch(ex){$(this).val('')};
			if($(this).attr('data_type') == 'price' && $(this).val() == ''){
				$(this).val($('input[name="price"]').val());
			}
			if($(this).attr('data_type') == 'market_price' && $(this).val() == ''){
				$(this).val($('input[name="market_price"]').val());
			}
			if($(this).attr('data_type') == 'cost_price' && $(this).val() == ''){
				$(this).val($('input[name="cost_price"]').val());
			}
			if($(this).attr('data_type') == 'sku' && $(this).val() == ''){
				$(this).val(parseInt($('input[name="code"]').val())+(i));
				i++;
			}
		});
	count_stock();
	count_price('price');
	count_price('market_price');
	count_price('cost_price');
	code();
}

function count_stock(){
	var stock = 0;
	$('input[data_type="stock"]').each(function(){
		if($(this).val() != ''){
			stock += parseInt($(this).val());
		}
	});
	$('input[name="amount"]').val(stock);
}

function code(){
	var max = 0.01;
	var min = 10000000;
	$('input[data_type="sku"]').each(function(){
		if($(this).val() != ''){
			max = Math.max(max,$(this).val());
			min = Math.min(min,$(this).val());
		}
	});
	if($('input[name="code"]').val()!='0' && !$('input[name="code"]').val())
	{
		if(min != 10000000){
			$('input[name="code"]').val(min);
		}
	}
}

function count_price(obj){
	var max = 0.01;
	var min = 10000000;
	$('input[data_type="'+obj+'"]').each(function(){
		if($(this).val() != ''){
			max = Math.max(max,$(this).val());
			min = Math.min(min,$(this).val());
		}
	});
	if(min != 10000000){
		$('input[name="'+obj+'"]').val(min.toFixed(2));
	}
}

function pic_show(Obj){
	var V = $('#color').find('input[type="checkbox"]:checked');
	if(V.length == 0){	
		$('table[data_type="color_img"]').hide();
	}else{
		$('table[data_type="color_img"]').show();
	}
	var S = $('tr[id="color_img_tr_'+Obj.val()+'"]');
	if(S.css('display') == 'none'){
		S.show();
	}else{
		S.hide();
	}
}

$(function(){
	var E_SP = new Array();
	var E_SPV = new Array();
	
	<?php $_from = $this->_tpl_vars['de']['porperty']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['list']):
?>
		<?php $_from = $this->_tpl_vars['list']['setmeal']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['slist']):
?>
			<?php $_from = $this->_tpl_vars['slist']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['num'] => $this->_tpl_vars['val']):
?>
				E_SP[<?php echo $this->_tpl_vars['num']; ?>
] = '<?php echo $this->_tpl_vars['val']; ?>
';
			<?php endforeach; endif; unset($_from); ?>
			E_SPV['i_<?php echo $this->_tpl_vars['list']['property_value_id']; ?>
|price'] = '<?php echo $this->_tpl_vars['list']['price']; ?>
';
			E_SPV['i_<?php echo $this->_tpl_vars['list']['property_value_id']; ?>
|market_price'] = '<?php echo $this->_tpl_vars['list']['market_price']; ?>
';
			E_SPV['i_<?php echo $this->_tpl_vars['list']['property_value_id']; ?>
|cost_price'] = '<?php echo $this->_tpl_vars['list']['cost_price']; ?>
';
			E_SPV['i_<?php echo $this->_tpl_vars['list']['property_value_id']; ?>
|stock'] = '<?php echo $this->_tpl_vars['list']['stock']; ?>
';
			E_SPV['i_<?php echo $this->_tpl_vars['list']['property_value_id']; ?>
|sku'] = '<?php echo $this->_tpl_vars['list']['sku']; ?>
';
		<?php endforeach; endif; unset($_from); ?>	
	<?php endforeach; endif; unset($_from); ?>
	
	V = E_SPV;
	
	$('.firstvalue').find('input[type="checkbox"]').each(function(){
		$('input[name="price"]').attr('readonly','readonly').css('background','#E7E7E7 none');
		$('input[name="market_price"]').attr('readonly','readonly').css('background','#E7E7E7 none');
		$('input[name="cost_price"]').attr('readonly','readonly').css('background','#E7E7E7 none');
		$('input[name="amount"]').attr('readonly','readonly').css('background','#E7E7E7 none');
		$('input[name="code"]').attr('readonly','readonly').css('background','#E7E7E7 none');
		$('tbody[data_type="property_tbody"]').show();
	});

	into_set();

	str = '<tr>';
	
	<?php echo $this->_tpl_vars['abc']; ?>

	
	if(str == '<tr>'){
		$('input[name="price"]').attr('readonly','').css('background','');
		$('input[name="market_price"]').attr('readonly','').css('background','');
		$('input[name="cost_price"]').attr('readonly','').css('background','');
		$('input[name="amount"]').attr('readonly','').css('background','');
		$('input[name="code"]').attr('readonly','').css('background','');
		$('tbody[data_type="property_tbody"]').hide();
	}
	$('tbody[data_type="property_table"]')
		.empty()
		.html(str)
		.find('input[type="text"]').each(function(){
			s = $(this).attr('data_value');
			try{$(this).val(E_SPV[s])}catch(ex){$(this).val('')};
		});
	
	$('#color').find('input[type="checkbox"]:checked').each(function(){
		pic_show($(this));
	});
});
</script>